package com.lxq.action;

import com.lxq.model.Role;
import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;

import java.util.Arrays;
import java.util.Map;
@SessionAttributes(value ={"name"},types = Integer.class)
@Controller
public class testController  {
        @RequestMapping("/tests")
    public  String tset(Map<String,Object> map){
        map.put("name", Arrays.asList("l","x","q"));
        map.put("age",20);
        return "test";
    }
    @RequestMapping("/tests2")
    public ModelAndView test2(){
        ModelAndView mv=new ModelAndView();
        Role role=new Role();
        role.setRolename("管理员");
        mv.addObject("role",role);
        mv.setViewName("test");
        return mv;
    }

    @RequestMapping("/tests3")
    public String test3(Model model){
            Role role=new Role();
            role.setRolename("putong");
            model.addAttribute("roole",role);
            return "test";
    }
}
